package com.hw.esay.myExam;

import java.util.Arrays;
import java.util.Scanner;
//蛇形矩阵

/**
 * 你需要输出一个n行n列的上三角形蛇形矩阵。
 */
public class HJ35 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()){
            int n = scan.nextInt();
            int hang=1;
            int lie=1;
            int a= 1;
            for (int i = 0; i < n ; i++) {
                int b=2+i;
                for (int j = 1; j <= n-i ; j++) {
                    System.out.print(hang+" ");
                    hang=hang+b;
                    b++;
                }
                lie = lie +a;
                a++;
                hang =lie;
                System.out.println();
            }
        }
    }
}
